package com.blkbox.javaee.quartz.version1_8;

import java.util.Date;

import org.quartz.JobDetail;
import org.quartz.Scheduler;
import org.quartz.SchedulerException;
import org.quartz.SchedulerFactory;
import org.quartz.SimpleTrigger;
import org.quartz.impl.StdSchedulerFactory;

import com.blkbox.javaee.quartz.version2_0.SimpleQuartzJob;

public class SimpleTriggerTest {
	/*
	public static void main(String[] args) throws SchedulerException {
		//0. Initiate a Schedule Factory
		SchedulerFactory schedulerFactory = new StdSchedulerFactory();
		Scheduler scheduler = schedulerFactory.getScheduler();
		//1. start time
		long ctime = System.currentTimeMillis();
		//2. prepare job 
		JobDetail jobDetail = new JobDetail("jobName-1", "jobNameGroup-1", SimpleQuartzJob.class);
		//3. prepare trigger
		SimpleTrigger simpleTrigger = new SimpleTrigger("simpleTriggerName-1", "simpleTriggerGroup-1");
		simpleTrigger.setStartTime(new Date(ctime));
		simpleTrigger.setRepeatInterval(10000);// set the interval, how often the job should run (10 seconds here)
		simpleTrigger.setRepeatCount(100);// set the number of execution of this job, set to 10 times.It will run 10 time and exhaust.
		// set the ending time of this job. We set it for 60 seconds from its startup time here.
		// Even if we set its repeat count to 10, this will stop its process after 6 repeats as it gets it endtime by then.
		simpleTrigger.setEndTime(new Date(ctime + 60000L)); 
		//4. start the scheduler
		scheduler.scheduleJob(jobDetail, simpleTrigger);
		//5. start the scheduler
		scheduler.start();
	}
	*/

}
